#pragma once
#include "stdafx.h"
#include "Chicken.h"
#include "PlayerControl.h"
#include "Weasel.h"
#include "Egg.h"
#include "Nest.h"
#include <vector>

using namespace sf;
using namespace std;

class ChickenDefGame
{

	RenderWindow *wnd;
	Event evt;


	//background
	Sprite m_sprBack;


	//Gallinas
	Chicken* m_Player1;
	Chicken* m_Player2;

    // controles
    PlayerControl *m_control_p1, *m_control_p2;


	//Comadrejas y huevos
	vector<Weasel*> m_weasels;
	vector<Egg* > m_eggs;

	int m_NWeasels; //cantidad de comadrejas activas
	static const int m_maxWeasels=50;
	static const int m_maxEggs=100;
	
	//role changing
	void ChangeRoles();
	void UpdateSwitch(float dt);
	float timeToSwitch;
	float timeElapsed;
	
public:

	//nido
	//aca comienzan las chanchadas 
	Nest* nest;


	Egg* GetEgg();
	void Loop();
	bool ProcessEvents();
	void Reset();
	void UpdateWeasels();
	void UpdateEggs();
	void DrawWeasels();
	void DrawEggs();

	//dice si un punto se salio del area de juego
	bool OutOfBounds(Vector2f p);
	Weasel* CircleCollidesWithWeasels(Vector2f center, float r);
	ChickenDefGame(void);
	~ChickenDefGame(void);
};

